home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _41CB74A457274F8D920BF7E25932136D < prev    next >
Encoding:
Text File  |  2004-01-06  |  1.3 KB  |  56 lines

  1.  
  2. -- created by petar
  3. --------------------------
  4.  
  5.  
  6. AIBehaviour.Job_RunToActivated = {
  7.     Name = "Job_RunToActivated",                
  8.     JOB = 1,
  9.  
  10.  
  11.     ---------------------------------------------
  12.     OnSpawn = function(self,entity )
  13.         entity:InitAIRelaxed();
  14.  
  15.         AI:CreateGoalPipe("run_to");
  16.         AI:PushGoal("run_to","run",0,1);
  17.         if (entity.cnt:GetCurrWeapon()) then
  18.             AI:PushGoal("run_to","bodypos",0,BODYPOS_STAND);
  19.         else
  20.             if (entity.Properties.special == 1) then 
  21.                 AI:MakePuppetIgnorant(entity.id,1);
  22.             end
  23.             AI:PushGoal("run_to","bodypos",0,BODYPOS_RELAX);
  24.         end
  25.         
  26.         AI:PushGoal("run_to","acqtarget",0,"");
  27.         AI:PushGoal("run_to","approach",1,1);
  28.  
  29.         
  30.  
  31.         
  32.     end,
  33.     ---------------------------------------------
  34.     OnActivate = function( self, entity )
  35.         -- called when enemy receives an activate event (from a trigger, for example)
  36.         
  37.         -- try to get tagpoint of the same name as yourself first
  38.         local run_target = entity:GetName().."_RUNTO";
  39.         
  40.         local TagPoint = Game:GetTagPoint(run_target);
  41.  
  42.         if (TagPoint) then 
  43.             entity:SelectPipe(0,"run_to",run_target);    
  44.         else
  45.             System:Warning( "[AI] Entity "..entity:GetName().." has run job assigned to it but no tag point name_RUNTO.");
  46.         end
  47.  
  48.         entity:InsertSubpipe(0,"setup_idle");
  49.         
  50.     end,
  51.  
  52.     
  53. }
  54.  
  55.  
  56.